// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Author: wsfuyibing <682805@qq.com>
// Date: 2024-11-18

package common

const (
    AttrHeader        = "http.header"
    AttrProtocol      = "http.protocol"
    AttrRequestMethod = "http.request.method"
    AttrRequestUrl    = "http.request.url"
    AttrUserAgent     = "http.user.agent"
)

// Attr
// 属性参数.
type Attr map[string]any

func (o Attr) Count() int                { return len(o) }
func (o Attr) Set(key string, value any) { o[key] = value }
func (o Attr) SetHeader(val any)         { o.Set(AttrHeader, val) }
func (o Attr) SetProtocol(val any)       { o.Set(AttrProtocol, val) }
func (o Attr) SetRequestMethod(val any)  { o.Set(AttrRequestMethod, val) }
func (o Attr) SetRequestUrl(val any)     { o.Set(AttrRequestUrl, val) }
func (o Attr) SetUserAgent(val any)      { o.Set(AttrUserAgent, val) }
func (o Attr) Unset(key string)          { delete(o, key) }
